package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.BywEmployeeMapper;
import com.ruoyi.system.domain.BywEmployee;
import com.ruoyi.system.service.IBywEmployeeService;

/**
 * 用户Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-05-24
 */
@Service
public class BywEmployeeServiceImpl implements IBywEmployeeService 
{
    @Autowired
    private BywEmployeeMapper bywEmployeeMapper;

    /**
     * 查询用户
     * 
     * @param id 用户主键
     * @return 用户
     */
    @Override
    public BywEmployee selectBywEmployeeById(Long id)
    {
        return bywEmployeeMapper.selectBywEmployeeById(id);
    }

    @Override
    public BywEmployee selectEmployeeByPhone(String phone)
    {
        return bywEmployeeMapper.selectEmployeeByPhone(phone);
    }

    /**
     * 查询用户列表
     * 
     * @param bywEmployee 用户
     * @return 用户
     */
    @Override
    public List<BywEmployee> selectBywEmployeeList(BywEmployee bywEmployee)
    {
        return bywEmployeeMapper.selectBywEmployeeList(bywEmployee);
    }

    /**
     * 新增用户
     * 
     * @param bywEmployee 用户
     * @return 结果
     */
    @Override
    public int insertBywEmployee(BywEmployee bywEmployee)
    {
        bywEmployee.setCreateTime(DateUtils.getNowDate());
        return bywEmployeeMapper.insertBywEmployee(bywEmployee);
    }

    /**
     * 修改用户
     * 
     * @param bywEmployee 用户
     * @return 结果
     */
    @Override
    public int updateBywEmployee(BywEmployee bywEmployee)
    {
        bywEmployee.setUpdateTime(DateUtils.getNowDate());
        return bywEmployeeMapper.updateBywEmployee(bywEmployee);
    }

    @Override
    public int updateEmployeeByPhone(BywEmployee bywEmployee)
    {
        bywEmployee.setUpdateTime(DateUtils.getNowDate());
        return bywEmployeeMapper.updateEmployeeByPhone(bywEmployee);
    }

    /**
     * 批量删除用户
     * 
     * @param ids 需要删除的用户主键
     * @return 结果
     */
    @Override
    public int deleteBywEmployeeByIds(Long[] ids)
    {
        return bywEmployeeMapper.deleteBywEmployeeByIds(ids);
    }

    /**
     * 删除用户信息
     * 
     * @param id 用户主键
     * @return 结果
     */
    @Override
    public int deleteBywEmployeeById(Long id)
    {
        return bywEmployeeMapper.deleteBywEmployeeById(id);
    }
}
